<script setup lang="ts">
import {ref} from "vue";
import {useRouter} from "vue-router";


const active1 = ref("1")
const userAccount = ref("")
const userPassword = ref("")

const router = useRouter()

const replay = (e: any, animClass: any) => {
  const el = e.currentTarget;
  const targetClass = el.classList[1];
  if(!targetClass){
    el.classList.add(animClass);
  }else{
    el.classList.remove(targetClass);
    setTimeout(() => {
      el.classList.add(targetClass);
    },100)
  }
}

const Login = () => {
  router.push('/admin/user')
}
</script>

<template>
<div class="admin-login">
  <div class="left">
    <lay-carousel class="carousel" v-model="active1">
      <lay-carousel-item id="1">
        <img src="https://w.wallhaven.cc/full/jx/wallhaven-jxl31y.png" alt="">
      </lay-carousel-item>
      <lay-carousel-item id="2">
        <img src="https://w.wallhaven.cc/full/kx/wallhaven-kxj3l1.jpg" alt="">
      </lay-carousel-item>
      <lay-carousel-item id="3">
        <img src="https://w.wallhaven.cc/full/we/wallhaven-wexzmx.jpg" alt="">
      </lay-carousel-item>
    </lay-carousel>
  </div>
  <div class="right">
    <div class="login">
      <div class="form layui-anim layui-anim-down">
        <div class="title">欢迎来到<br><span>轻语后台管理系统</span></div>
        <input v-model="userAccount" class="input" placeholder="账号" type="text">
        <input v-model="userPassword" class="input" placeholder="密码" type="password">
        <button class="button-confirm" @click="Login">进入 →</button>
      </div>
    </div>
  </div>
</div>
</template>

<style scoped>
.admin-login {
  width: 100vw;
  height: 100vh;
  display: flex;
}
.left {
  width: 70%;
  height: 100vh;
}
.right {
  width: 30%;
  background-color: #B4BDFF;
}
.carousel {
  height: 100vh !important;
}
img {
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.login {
  width: 400px;
  height: 600px;
  margin: 0 auto;
  transform: translate(0, 25%);
}

.form {
  --input-focus: #2d8cf0;
  --font-color: #323232;
  --font-color-sub: #666;
  --bg-color: beige;
  --main-color: black;
  padding: 20px;
  background: lightblue;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  border-radius: 5px;
  border: 2px solid var(--main-color);
  box-shadow: 4px 4px var(--main-color);
}

.title {
  color: var(--font-color);
  font-weight: 900;
  font-size: 20px;
  margin-bottom: 25px;
}

.title span {
  color: var(--font-color-sub);
  font-weight: 600;
  font-size: 17px;
}

.input {
  width: 250px;
  height: 40px;
  border-radius: 5px;
  border: 2px solid var(--main-color);
  background-color: var(--bg-color);
  box-shadow: 4px 4px var(--main-color);
  font-size: 15px;
  font-weight: 600;
  color: var(--font-color);
  padding: 5px 10px;
  outline: none;
}

.input::placeholder {
  color: var(--font-color-sub);
  opacity: 0.8;
}

.input:focus {
  border: 2px solid var(--input-focus);
}

.button-confirm {
  margin: 50px auto 0 auto;
  width: 120px;
  height: 40px;
  border-radius: 5px;
  border: 2px solid var(--main-color);
  background-color: var(--bg-color);
  box-shadow: 4px 4px var(--main-color);
  font-size: 17px;
  font-weight: 600;
  color: var(--font-color);
  cursor: pointer;
}

</style>